<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function delay(f,ms){
        return function (fn,...args){
            setTimeout(()=>{
                let res = f.apply(this,args)
                fn(res)
            },ms)
        }
    }

    let user ={
        age:20,
        getAge(nums){
            return this.age-nums
        }
    }
    user.getAge = delay(user.getAge,2000)
    user.getAge(res =>{
        console.log(res)
    },1)
</script>
</body>
</html>